package com.yawn.demomybatisxml.controller;

import com.yawn.demomybatisxml.entity.School;
import com.yawn.demomybatisxml.mapper.SchoolMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/school")
public class SchoolController {

    @Autowired
    private SchoolMapper schoolMapper;

    @GetMapping("/list")
    public List<School> list() {
        return schoolMapper.list();
    }
    @GetMapping("/get")
    public School get(int id) {
        return schoolMapper.get(id);
    }
}
